// 引入api请求requestSkuIdList
import { requestSkuIdList } from '@/api'
const state = {
  SkuIdList: {}
}
const mutations = {
  SetSkuIdList(state, value) {
    state.SkuIdList = value
  }
}
const actions = {
  //异步发送axios请求获取数据 接受skuId来获取数据
  async requestSkuIdList({ commit }, skuId) {
    const res = await requestSkuIdList(skuId)
    commit('SetSkuIdList', res)
  }
}
const getters = {
  categoryView(state) {
    return state.SkuIdList.categoryView || {}
  },
  skuInfo(state) {
    return state.SkuIdList.skuInfo || {}
  },
  spuSaleAttrList(state) {
    return state.SkuIdList.spuSaleAttrList || {}
  }
}
// 暴漏出去
export default {
  // 命名空间打开
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}